//
//  UIView+Frame.h
//  Extision
//
//  Created by 岳道峰 on 2017/4/2.
//  Copyright © 2017年 hao. All rights reserved.
//

#import <UIKit/UIKit.h>

/**
 *  UIScreen width.
 */
#define  ScreenWidth   [UIScreen mainScreen].bounds.size.width

/**
 *  UIScreen height.
 */
#define  ScreenHeight  [UIScreen mainScreen].bounds.size.height

/**
 *  Status bar height.
 */
#define  StatusBarHeight      20.f

/**
 *  Navigation bar height.
 */
#define  NavigationBarHeight  44.f

/**
 *  Tabbar height.
 */
#define  TabbarHeight         (iPhone_X ? (34.f+49.f) : 49.f)

#define  X_StatusBarHeight    44.f
/** 底部多余的高度 */
#define  X_BottomExtraHeight  34.f

/**
 *  Status bar & navigation bar height.
 */
#define  StatusBarAndNavigationBarHeight   (iPhone_X ? (44.f + 44.f) : (20.f + 44.f))

#define  iPhone4_4s     (ScreenWidth == 320.f && ScreenHeight == 480.f ? YES : NO)

/**
 *  iPhone5 or iPhone5s
 */
#define  iPhone5_5s     (ScreenWidth == 320.f && ScreenHeight == 568.f ? YES : NO)

/**
 *  iPhone6 or iPhone6s
 */
#define  iPhone6_6s     (ScreenWidth == 375.f && ScreenHeight == 667.f ? YES : NO)

/**
 *  iPhone6Plus or iPhone6sPlus
 */
#define  iPhone6_6sPlus (ScreenWidth == 414.f && ScreenHeight == 736.f ? YES : NO)

#define  iPhone_X       (ScreenWidth == 375.f && ScreenHeight == 812.f ? YES : NO)

@interface UIView (Frame)

/** 从Xib加载View */
+ (instancetype)viewFromXib:(Class)className;
+ (instancetype)viewFromXibName:(NSString *)name;

/** 是否显示在主窗口 */
- (BOOL)isShowingOnKeyWindow;

@property (nonatomic, assign) CGSize size;

@property (nonatomic, assign) CGFloat width;

@property (nonatomic, assign) CGFloat height;

@property (nonatomic, assign) CGFloat x;

@property (nonatomic, assign) CGFloat y;
/** 中点X值 */
@property (nonatomic, assign) CGFloat center_x;
/** 中点Y值 */
@property (nonatomic, assign) CGFloat center_y;
/** 最大X值 */
@property (nonatomic, assign, readonly) CGFloat max_x;
/** 最大Y值 */
@property (nonatomic, assign, readonly) CGFloat max_y;
/** 最小X值 */
@property (nonatomic, assign, readonly) CGFloat min_x;
/** 最小Y值 */
@property (nonatomic, assign, readonly) CGFloat min_y;
/** bounds的x和y默认为零，除特殊控件外， 相当于设置内容偏移量 */
@property (nonatomic, assign) CGFloat bounds_x;

@property (nonatomic, assign) CGFloat bounds_y;

@end
